package Main;

/**
 *
 * @author Wilco
 */
public class GameObjects {
    
    int type;   //Type 1:   default         black
                //Type 2:   paddle dec      greymm
                //Type 3:   invisable       pink
                //Type 4:   invert controls red
                //Type 5:   paddle inc      blue
                //Type 6:   health          green
    double X, Y;
    double velocityX, velocityY;
    double size;
    int colour;
    
    public GameObjects() 
       {
           type = 0;
           X = 0.5;
           Y = 0.5;
           velocityX = 0;
           velocityY = 0;
           size = 0.1;
           colour = 0;
       }
    
    public GameObjects(int t, double x, double y, double vx, double vy, double s) 
       {
           type = t;
           X = x;
           Y = y;
           velocityX = vx;
           velocityY = vy;
           size = s;
           colour = 0;
       }
    
    //<editor-fold defaultstate="collapsed" desc="Getters and Setters">
    public void setType (int t){this.type = t;}
    public void setX(double newX)   { this.X = newX;}       
    public void setY(double newY)   { this.Y = newY;} 
    public void setVelocityX(double newV)   { this.velocityX = newV;}       
    public void setVelocityY(double newV)   { this.velocityY = newV;}
    public void setSize(double newSize)     { this.size = newSize;}
    public void setColour(int c) {this.colour = c;}
    public int getType() { return this.type; }
    public double getX()    { return this.X;}       
    public double getY()    { return this.Y;}
    public double getVelocityX()     { return this.velocityX;}       
    public double getVelocityY()     { return this.velocityY;}
    public double getSize()     { return this.size;}
    public int getColour() {return this.colour;}
    //</editor-fold>
    
    public boolean move(double margin) //moves a round object within the limiting margin
    {
        boolean fieldOutX = false;
        boolean fieldOutY = false;
        
        this.X += this.velocityX;
        this.Y += this.velocityY;
           
        if((this.X <= margin || ((this.X + this.size) >= (1.0 - margin))) && this.velocityX != 0) //still in field
            fieldOutX =  true;
        
        if((this.Y < 0 || this.Y + this.size > 1 ) && this.velocityY != 0)
            fieldOutY =  true;
        
        return (fieldOutX || fieldOutY);
    }
    
    public boolean move(){return this.move(0);}
}